//
//  AocialContactCell.m
//  phmall
//
//  Created by admin on 2017/12/19.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "AocialContactCell.h"

@implementation AocialContactCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
+ (instancetype)theShareCellWithTableView:(UITableView *)tableView{
    
    static NSString *ID = @"SetCell";
    AocialContactCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[AocialContactCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
        cell.selectionStyle=UITableViewCellSelectionStyleNone;
    }
    return cell;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        self.contentView.backgroundColor=[UIColor groupTableViewBackgroundColor];
        
        self.back=[[UIView alloc]init];
        self.back.backgroundColor=[UIColor whiteColor];
        ViewBorderRadius(self.back, 5, 0, [UIColor clearColor]);
        [self.contentView addSubview:self.back];
        
        
        self.img=[[UIImageView alloc]init];
        self.img.image=[UIImage imageNamed:@"图片"];
        ViewBorderRadius(self.img, 5, 1, [UIColor groupTableViewBackgroundColor]);
        [self.back addSubview:self.img];
        
        self.name=[[UILabel alloc]init];
        self.name.text=@"你猜你猜你猜猜猜你猜你猜你猜猜猜";
        self.name.numberOfLines=2;
        self.name.textColor=[UIColor blackColor];
        self.name.font=[UIFont systemFontOfSize:15];
        [self.back addSubview:self.name];
        
        self.price=[[UILabel alloc]init];
        self.price.text=@"₱8888.80";
        self.price.textColor=[UIColor orangeColor];
        self.price.font=[UIFont systemFontOfSize:15];
        [self.back addSubview:self.price];
        
        self.state=[[UILabel alloc]init];
        self.state.text=@"状态:未审核";
        self.state.textColor=[UIColor colorWithHexString:@"#adadad"];
        self.state.font=[UIFont systemFontOfSize:13];
        [self.back addSubview:self.state];
        
        self.number=[[UILabel alloc]init];
        self.number.text=@"数量:100件";
        self.number.textColor=[UIColor colorWithHexString:@"#adadad"];
        self.number.font=[UIFont systemFontOfSize:13];
        [self.back addSubview:self.number];
        
        self.edit=[UIButton buttonWithType:UIButtonTypeCustom];
        [self.back addSubview:self.edit];
        [self.edit setImage:[UIImage imageNamed:@"编辑黑"] forState:UIControlStateNormal];
       
        
    }
    return self;
}
-(void)layoutSubviews{
    [super layoutSubviews];
    CGSize superSize = self.contentView.frame.size;
    
    if (CGSizeEqualToSize(superSize, CGSizeZero)) {
        return;
    }
    

    [self.img mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.offset(10);
        make.bottom.offset(-10);
        make.width.equalTo(self.img.mas_height);
    }];
    
    [self.name mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.img.mas_right).offset(10);
        make.right.offset(-10);
        make.top.equalTo(self.img).offset(2);
    }];
    
    [self.price mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.img.mas_right).offset(10);
        make.bottom.offset(-12);
    }];
    
    [self.number mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.img.mas_right).offset(10);
        make.bottom.equalTo(self.price.mas_top).offset(-7);
    }];
    
    [self.state mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.img.mas_right).offset(10);
        make.bottom.equalTo(self.number.mas_top).offset(-7);
    }];
    
    [self.edit mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.right.offset(-10);
    }];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}


@end
